UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ScD3J9yvST+xd96R4x6X7FhdUCJn1axXETOMxC/0lWk=' 
WHERE 
  key_id = '9d845d88e90eda492859d6509e5f965349551ea8faf68133c8f44ad46f92c26f' 
  AND (
    token = 'ScD3J9yvST+xd96R4x6X7FhdUCJn1axXETOMxC/0lWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024