UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EQ54GDbtG5CjoE3YGppCAhawQO3uIe19AfCN3R3FOu4=' 
WHERE 
  key_id = '0939e67197c153bc4aca2b0d19d6699e5013333c75350b5403683ab2021a186e' 
  AND (
    token = 'EQ54GDbtG5CjoE3YGppCAhawQO3uIe19AfCN3R3FOu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036