UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OAv8I560p1F2WYEUKeERIjRfGb3VT+TEPlkrtZbEMy4=' 
WHERE 
  key_id = 'b385628e57f4d93bd887685a954775ddde177c8a00e22054935973294fe876d8' 
  AND (
    token = 'OAv8I560p1F2WYEUKeERIjRfGb3VT+TEPlkrtZbEMy4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025