UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uCNH5KuM6IChjHfnpReoO7u/6dKn6GM8vTUtLLkG4Nc=' 
WHERE 
  key_id = '8e3c4562c98c4ef267fa0c43d9d00342a21aac29177190835e5b02412cd18115' 
  AND (
    token = 'uCNH5KuM6IChjHfnpReoO7u/6dKn6GM8vTUtLLkG4Nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038