UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '87JzclGp1g5HC5br/Io+oPc7A/wj6mAVB2fDi9kHavc=' 
WHERE 
  key_id = '6fe7c2282e12865efe2822f15a75039014d963a8247be26a1fc3e537dd7577bd' 
  AND (
    token = '87JzclGp1g5HC5br/Io+oPc7A/wj6mAVB2fDi9kHavc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023