UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XkY/kBU8q8LkPPdhEZShjtzGrAM+H7tvZ/YzonUsao4=' 
WHERE 
  key_id = '458643a112919f3304821671953f9426c48fe6fd2f7397e43322de96e50dd39b' 
  AND (
    token = 'XkY/kBU8q8LkPPdhEZShjtzGrAM+H7tvZ/YzonUsao4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00083