UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bYcauUkYMyE3AYlvmMn76MvarPfi+RXR1fviN4kQLEY=' 
WHERE 
  key_id = '6e6f2ad6931f026afb034e7210c69fd63a7d1bc4fcdcf4f81640a7eb92a23641' 
  AND (
    token = 'bYcauUkYMyE3AYlvmMn76MvarPfi+RXR1fviN4kQLEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038