UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TB+BfX3HK33sogrj59npZRQQYgxWaoKRb/OeITFq5co=' 
WHERE 
  key_id = '885f3a843be0d6037186e8b6e27d0d2baa421321538544aee3496332eb780c9a' 
  AND (
    token = 'TB+BfX3HK33sogrj59npZRQQYgxWaoKRb/OeITFq5co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040