UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'J42OF+y1FKS1JD6yeb0BYbvwFr/zGmR7JxUsPJ66QHQ=' 
WHERE 
  key_id = 'a8df25c43f47a763e8321ef9d863861029c1f5f44064ae132ae34d31d8ba501c' 
  AND (
    token = 'J42OF+y1FKS1JD6yeb0BYbvwFr/zGmR7JxUsPJ66QHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045