UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SCS5+ZDPRbj+xglPqPgrTh037PZ1xUye0h/oZ1eJduc=' 
WHERE 
  key_id = 'f71f823d1ef0ec505f6b3d7426ec764ff844247f64366a30cd0d9c0230600927' 
  AND (
    token = 'SCS5+ZDPRbj+xglPqPgrTh037PZ1xUye0h/oZ1eJduc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033