UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2w7hHjhmnrFNAqeTEgYPoWjLSkRhuy9VxRCwTRtnIOM=' 
WHERE 
  key_id = '159863be09e5020283629cf5466649a59547f24b74af5fc055cc9e21764c7ed4' 
  AND (
    token = '2w7hHjhmnrFNAqeTEgYPoWjLSkRhuy9VxRCwTRtnIOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052