UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e9peJrS3YHQR5fi4gsRtMUDQDCJcgEIk6ZYzj+X3g7A=' 
WHERE 
  key_id = '6d76dd5876526272a1bf035cb487f9653de7655e1ab67f5b1da42ff60b222192' 
  AND (
    token = 'e9peJrS3YHQR5fi4gsRtMUDQDCJcgEIk6ZYzj+X3g7A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040