UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cay01CHow2wooBBS+NPuQR44Hhc4xSHdbMSdwESaTtg=' 
WHERE 
  key_id = '4e48ed56fae47d7720df985fbb8b87f0997692a46b53dd206fdca47907ad0efe' 
  AND (
    token = 'Cay01CHow2wooBBS+NPuQR44Hhc4xSHdbMSdwESaTtg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024