UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c3yUZRGR+RmjYptjuzd1vr8VsVLAbTg0aToqmfMEEdg=' 
WHERE 
  key_id = '76d61ae206310d797d639d2121b4ab0d555de9990f2b249e3b50b7fff74b47ce' 
  AND (
    token = 'c3yUZRGR+RmjYptjuzd1vr8VsVLAbTg0aToqmfMEEdg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044